/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package numberpickerfx.logic;

import java.util.Random;

/**
 *
 * @author zengchen
 */
public class RandomNumber implements IRandomNumber{
    /**
     * Set range [min, max]
     * @param min minimum value to be generated.
     * @param max maximum value to be generated.
     */
    public RandomNumber(int min, int max){
        this.min = min;
        this.max = max;
        random = new Random();
    }
    
    /**
     * return a random integer in [min, max]
     * @return a random integer in [min, max]
     */
    @Override
    @SuppressWarnings("empty-statement")
    public int getNumber(){
        int i = 0;
        for(i = random.nextInt(max); i < min; i = random.nextInt(max));
        return i;
    }
    protected final int min, max;
    protected Random random;
}
